package com.bootlever.framework.core.web.resources;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * 修改项目静态资源访问路径
 * /bootlever/resources/       路径resources/bootlever/static/
 */
@Configuration
public class StaticResourceConfiguration extends WebMvcConfigurerAdapter {

    private static final String RESOURCES_HANDLER = "/bootlever/resources";
    private static final String RESOURCES_LOCATIONS = "classpath:/bootlever/static";

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler(RESOURCES_HANDLER).addResourceLocations(RESOURCES_LOCATIONS);
    }
}
